import cv2
import numpy as np
from matplotlib import pyplot as plt


prewittx=np.array([[-1,0,1],[-1,0,1],[-1,0,1]])
prewitty=np.array([[1,1,1],[0,0,0],[-1,-1,-1]])


img = cv2.imread(r'..\misc_pic\A.png',0)
dx=cv2.filter2D(img,-1,prewittx)
dy=cv2.filter2D(img,-1,prewitty)


plt.gray()
plt.subplot(121)
plt.imshow(dx)
plt.subplot(122)
plt.imshow(dy)
plt.show()


